/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : structs_internal
	/// </summary>
	public class CentralPlayerPOD : IPOD 
    {
        public readonly static Func<CentralPlayerPOD> FACTORY = () => new CentralPlayerPOD();
		public static Func<CentralPlayerPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
		public long pid;
		/// <summary>
        /// 
        /// </summary>
		public string uid;
		/// <summary>
        /// 
        /// </summary>
		public int guid;
		/// <summary>
        /// 
        /// </summary>
		public string playerName;
		/// <summary>
        /// 
        /// </summary>
		public int roleCid;
		/// <summary>
        /// 
        /// </summary>
		public int level;
		/// <summary>
        /// 
        /// </summary>
		public bool isRobot;
		/// <summary>
        /// 
        /// </summary>
		public long createTime;
		/// <summary>
        /// 
        /// </summary>
		public long lastLoginTime;
		/// <summary>
        /// 
        /// </summary>
		public long lastLogoutTime;
		/// <summary>
        /// 
        /// </summary>
		public long banSpeakEndTime;
		/// <summary>
        /// 
        /// </summary>
		public string gameServerId;
		/// <summary>
        /// 
        /// </summary>
		public int avatar;
		/// <summary>
        /// 
        /// </summary>
		public int avatarFrame;
		/// <summary>
        /// 
        /// </summary>
		public int title;
		/// <summary>
        /// 
        /// </summary>
		public double totalCharge;
		
		
		
		/*-- constructors --*/
		public CentralPlayerPOD() {}
		public CentralPlayerPOD(long pid, string uid, int guid, string playerName, int roleCid, int level, bool isRobot, long createTime, long lastLoginTime, long lastLogoutTime, long banSpeakEndTime, string gameServerId, int avatar, int avatarFrame, int title, double totalCharge) {
			this.pid = pid;
			this.uid = uid;
			this.guid = guid;
			this.playerName = playerName;
			this.roleCid = roleCid;
			this.level = level;
			this.isRobot = isRobot;
			this.createTime = createTime;
			this.lastLoginTime = lastLoginTime;
			this.lastLogoutTime = lastLogoutTime;
			this.banSpeakEndTime = banSpeakEndTime;
			this.gameServerId = gameServerId;
			this.avatar = avatar;
			this.avatarFrame = avatarFrame;
			this.title = title;
			this.totalCharge = totalCharge;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_long(pid);
            _out.Write_string(uid);
            _out.Write_int(guid);
            _out.Write_string(playerName);
            _out.Write_int(roleCid);
            _out.Write_int(level);
            _out.Write_boolean(isRobot);
            _out.Write_long(createTime);
            _out.Write_long(lastLoginTime);
            _out.Write_long(lastLogoutTime);
            _out.Write_long(banSpeakEndTime);
            _out.Write_string(gameServerId);
            _out.Write_int(avatar);
            _out.Write_int(avatarFrame);
            _out.Write_int(title);
            _out.Write_double(totalCharge);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            pid = _in.Read_long();
            if(!_in.HasRemaining()) return;
            uid = _in.Read_string();
            if(!_in.HasRemaining()) return;
            guid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            playerName = _in.Read_string();
            if(!_in.HasRemaining()) return;
            roleCid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            level = _in.Read_int();
            if(!_in.HasRemaining()) return;
            isRobot = _in.Read_boolean();
            if(!_in.HasRemaining()) return;
            createTime = _in.Read_long();
            if(!_in.HasRemaining()) return;
            lastLoginTime = _in.Read_long();
            if(!_in.HasRemaining()) return;
            lastLogoutTime = _in.Read_long();
            if(!_in.HasRemaining()) return;
            banSpeakEndTime = _in.Read_long();
            if(!_in.HasRemaining()) return;
            gameServerId = _in.Read_string();
            if(!_in.HasRemaining()) return;
            avatar = _in.Read_int();
            if(!_in.HasRemaining()) return;
            avatarFrame = _in.Read_int();
            if(!_in.HasRemaining()) return;
            title = _in.Read_int();
            if(!_in.HasRemaining()) return;
            totalCharge = _in.Read_double();
        }
		
		public CentralPlayerPOD Clone() {
            CentralPlayerPOD o = DynamicFactory();
            o.pid = pid;
            o.uid = uid;
            o.guid = guid;
            o.playerName = playerName;
            o.roleCid = roleCid;
            o.level = level;
            o.isRobot = isRobot;
            o.createTime = createTime;
            o.lastLoginTime = lastLoginTime;
            o.lastLogoutTime = lastLogoutTime;
            o.banSpeakEndTime = banSpeakEndTime;
            o.gameServerId = gameServerId;
            o.avatar = avatar;
            o.avatarFrame = avatarFrame;
            o.title = title;
            o.totalCharge = totalCharge;
            return o;
        }
        
        public void Clear() {
            pid = default;
            uid = default;
            guid = default;
            playerName = default;
            roleCid = default;
            level = default;
            isRobot = default;
            createTime = default;
            lastLoginTime = default;
            lastLogoutTime = default;
            banSpeakEndTime = default;
            gameServerId = default;
            avatar = default;
            avatarFrame = default;
            title = default;
            totalCharge = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "CentralPlayerPOD [";
			str += "pid=";
			str += pid;
			str += ", uid=";
			str += uid;
			str += ", guid=";
			str += guid;
			str += ", playerName=";
			str += playerName;
			str += ", roleCid=";
			str += roleCid;
			str += ", level=";
			str += level;
			str += ", isRobot=";
			str += isRobot;
			str += ", createTime=";
			str += createTime;
			str += ", lastLoginTime=";
			str += lastLoginTime;
			str += ", lastLogoutTime=";
			str += lastLogoutTime;
			str += ", banSpeakEndTime=";
			str += banSpeakEndTime;
			str += ", gameServerId=";
			str += gameServerId;
			str += ", avatar=";
			str += avatar;
			str += ", avatarFrame=";
			str += avatarFrame;
			str += ", title=";
			str += title;
			str += ", totalCharge=";
			str += totalCharge;
			str += "]";
			return str;
		}
		
	}
}